package mysql

import "gorm.io/gorm"

type Super struct {
	gorm.Model
	Name     string `gorm:"type:varchar(30);comment:管理员名称"`
	Password string `gorm:"type:varchar(32);comment:密码"`
}

func (Super) TableName() string {
	return "super"
}

func (s *Super) Login(name string, password string) (result Super, err error) {
	err = DB.Where("name=? and password=?", name, password).Find(&result).Error
	if err != nil {
		return Super{}, err
	}
	return result, nil
}
